import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

import org.fioma.tree.RootBytes;
import org.fioma.ui.Tools;

public class Test {

	/**
	 * @param args
	 * @throws IOException
	 * @throws NumberFormatException
	 */
	public static void main(String[] args) {
		try {
			RootBytes root = Tools.buildSuffixTree(args[0], Integer.parseInt(args[1]));
			BufferedWriter bw = new BufferedWriter(new FileWriter("tree", false));
			byte[] prefix = new byte[1];
			prefix[0] = 0;
			root.printWords(bw, prefix);
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
